//
// ImageTransferable.java
//
// This is the class to hold image data in clipboard
//
package com.photoexpert;

import java.awt.Image;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;

public class ImageTransferable implements Transferable {

    private static final DataFlavor _flavors[] = {DataFlavor.imageFlavor};
    private Image _image;

    public ImageTransferable(Image img) {
        _image = img;
    }

    @Override
    public Object getTransferData(DataFlavor flavor) {
        if(isDataFlavorSupported(flavor))
            return _image;
        return null;
    }

    @Override
    public DataFlavor[] getTransferDataFlavors() {
        return _flavors;
    }

    @Override
    public boolean isDataFlavorSupported(DataFlavor flavor) {
        return flavor.equals(_flavors[0]);
    }

}
